import java.util.*;

/**
 * 排序子序列
 * https://www.nowcoder.com/questionTerminal/2d3f6ddd82da445d804c95db22dcc471
 */
class Solution1
{

    public int LIS (int[] a)
    {
        int n = a.length;
        int dp[] = new int[n + 1];//长度为i的递增序列中最小值

        int pos = 0;
        for(int x : a){
            //初始化第一个元素和判断是否为递增趋势
            if(pos == 0 || dp[pos] < x){
                dp[++pos] = x;
            }else{
                //二分查找
                int l = 1,r = pos;
                while(l < r){
                    int mid = l + (r - l) / 2;
                    if(dp[mid] >= x) r = mid;
                    else l = mid + 1;
                }
                dp[l] = x;
            }
        }
        return pos;
    }
}

/**
 * 消除整数
 * https://ac.nowcoder.com/acm/problem/219038
 */
class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        int t = in.nextInt();

        while(t-- != 0){
            int h = in.nextInt();

            int a = 1;
            int cnt = 0;
            while(h != 0){
                h -= a;
                cnt++;
                if(h % (2 * a) == 0){
                    a = 2 * a;
                }
            }

            System.out.println(cnt);
        }
    }
}
/**
 * NC164 最长上升子序列(二)
 * https://www.nowcoder.com/practice/4af96fa010c44638a7e112abf65f7237?tpId=196&tqId=39285&ru=/exam/oj
 */
class Solution3
{

    public int LIS (int[] a)
    {
        int n = a.length;
        int dp[] = new int[n + 1];//长度为i的递增序列中最小值

        int pos = 0;//pos代表长度
        for(int x : a){
            //初始化第一个元素和判断是否为递增趋势
            if(pos == 0 || dp[pos] < x){
                dp[++pos] = x;
            }else{
                //二分查找
                int l = 1,r = pos;
                while(l < r){
                    int mid = l + (r - l) / 2;
                    if(dp[mid] >= x) r = mid;
                    else l = mid + 1;
                }
                dp[l] = x;
            }
        }
        return pos;
    }
}
